#ifndef __UTIL_H__
#define __UTIL_H__


static inline unsigned short int ReverseBit(unsigned short int data)
{
	//15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
	//printf("\r\nInput data is: %x\r\n",data);
	data = (data << 8) | (data >> 8);               //(1)7 6 5 4 3 2 1 0 15 14 13 12 11 10 9  8
	data = ((data << 4)&0xf0f0)|((data>>4)&0x0f0f); //(2)3 2 1 0 7 6 5 4 11 10 9  8  15 14 13 12
	data = ((data << 2)&0xcccc)|((data>>2)&0x3333); //(3)1 0 3 2 5 4 7 6 9  8  11 10 13 12 15 14
	data = ((data << 1)&0xaaaa)|((data>>1)&0x5555); //(4)0 1 2 3 4 5 6 7 8  9  10 11 12 13 14 15 
	//printf("\r\nOutput data is: %x\r\n",data);
	return data;
}

#endif 
